Hello we are going to continue from where we left off in part one where we were creating the functionality
using javascript.
I have added some more could here line 10.
Here's something I've introduced is called It Gets fuel don't focus this method or function.
What does it forces the cursor on the input bot button input box.
Where you make your guesses.
Case so this is a function from the previous lecture.
In this lecture.
I have just introduced a new function.
I have 144 here like 44.
I have attached an ADD event listner to the guess sub meet variable.
What did guess that guess submit.
Get -- we've got the guess submit
we've got.
Guess suddenly variable defined on line 5.
So what I'm doing here
line 44.
I have attached an event list now so what it will do it all list in out the event list 9 takes in two
parameters.
The first is the event which is the click.
The second is the check guess.
We've got a function coord check guest.
If I screw up we've got a function called check against on line 12.
We quit the financial code check guests so that's what is referring to here.
Just check guess.
So we take seem to this event list now takes in to perimeter's or arguments.
First is the event which is a click secon is a function call check.
Guess the function we already created will got a function here on line 46 that ends the line 53.
The function is called set.
Game over.
Basically this function is used to set the game when the game is over.
So in between this curly braces is what the function actually will do.
Note is that the guess field is set to disable and it gets solved.
It is set to disabled and the value is true.
What that means is that once the game is over you won't be.
It doesn't let you inputs anything that does let you submit.
Thus what line.
Forty seven point forty it means line 49 is the actual reset button so it will then create a button
which will have the text which you have the test detects to reset on it so you should have ditto's start
new game.
Sorry
let me go through that again.
Line 46 Chris page function cause set to Game Over.
This function is called When the game is over when all the attempts have been used.
An what like 40 740 a unfortified does it disable the ability for the player to enter.
Any more guesses are no sort to of meet anymore guesses.
That's why the value set to true.
Once the game is over.
You should not be able to input anything until the game is restarted.
Line 49 that a variable called reset button that variable is been set with a new value.
Would be opposed to a document but create element to it that is used to create a button.
Alright so once the game is over this button is treated and like 50 tells you to text.
Now beyond the button the text should say start new game this button only appears once The game is over
and then here on Life 2 on the third document the body or tappin child.
What that means is and once the game is over it will attach the button to the body of the document of
the email document as well.
The append means.
And then read this reset button or attached.
Saw on line 50 to the have title and event list now to the reset button.
This button was just been created and it takes in two values or arguments it click the click events
or when you click on it it respond.
And he also reset the game because this function reset the game.
This really sick game function is a function we've defined below here.
So this will be triggered once you reset the game using this set game over function.
So life 55 is a new function called Reset game and it's all online.
Fifty six it takes the first count to be one that is the first attempt and then Fifty eight is it a
variable called resaid Paris.
And you said that variable took equals to this query select or this group select or means it will count
or the paragraph that belongs to this class called result.
Paris like 59 says that for this is a for loop the loop.
So it is got a variable of hi which is kind of like the counter it started at an initial value of zero
and then the counter starts.
If the value of which is set to zero is less than the resaid power as does let the lenthall of it is
done that then the high value of a will increase blows plus means increase it will increase mound 1
and then like this to reset paragraph.
Here now the value of the eye which acts as a counter will be inserted inside this array.
This is an I read.
So it would be to insert caddies each of the numbers.
Each time the user has a goal that count is recorded inside this very okay and displayed here which
this is a blank.
It's a column.
It's just a space.
This creates a space where the numbers the temps will be record it line sixty three used a reset button.
So what happens is that once the game has been reset it.
This will remove the button from the page.
The button don't disappear.
This button only appears when you release when the game is finished and gives you an option to reset
the game once the game is in motion.
You do not see this button on line 63 so everything in here between the curly braces here and the one
on 74 is what will happen when the game is reset when the game is reset.
The ghosts feel is den reactivated it becomes forced families is now enabled you can put something in
it.
These submit button also DNA built is change the values change to force when the game is reset and when
the game is over and these values are true.
Line 6 to 7 gets fewer.
Don't value me as whatever value you guess the numbers are displayed here.
Then the sixty eight gets fewer dumped for cause.
These bizarre Achille's used to force on the input.
So now you see as you can focus on what you are typing in on the guesses you're making.
That's what this method is or function like 70 years after the last term this it will display a background
call or use in the style method of property anough set the cochère to this hex value which will be the
same as the caller or the background container of the game.
The same thing with this with the guesses but set to the same and then on line 7 the 3 it calls the
function random number calls is variable random number and it displays the Matt stook floor and then
inside ticcing the random number.
This is a guess so we basically restart the game again.
Once one C gets here causes and the process restarts again.
So that's basically it.
If any part is sounding confusing please let me know.
Are be modern happy to to explain or act.
Thanks for watching.
Bye for now.